﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="原料磅单录入.aspx.cs" Inherits="syc.Store.原料磅单录入" %>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
SelectCommand="select @原料ID=原料ID,@供货ID=供货ID,@日期=日期,@车号=车号
,@磅重1=磅重1,@磅重2=磅重2,@磅重3=磅重3,@磅重4=磅重4 from 原料磅单 where ID=@ID;"

InsertCommand="insert into 原料磅单(原料ID,供货ID,车号,日期,磅重1,磅重2,磅重3,磅重4,保管员)
values(@原料ID,@供货ID,@车号,@日期,@磅重1,@磅重2,@磅重3,@磅重4,@保管员);set @ID=@@IDENTITY;"

UpdateCommand="update 原料磅单 set 原料ID=@原料ID,供货ID=@供货ID,车号=@车号,日期=@日期
,磅重1=@磅重1,磅重2=@磅重2,磅重3=@磅重3,磅重4=@磅重4 where ID=@ID"
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
oninserted="SqlDataSource1_Inserted" onselected="SqlDataSource1_Selected" >
<SelectParameters>
<asp:Parameter Name="ID" DbType="Int32" Size="4" />
<asp:Parameter Name="原料ID" DbType="Int32" Size="4" Direction="Output" />
<asp:Parameter Name="供货ID" DbType="Int32" Size="4" Direction="Output" />
<asp:Parameter Name="车号" DbType="AnsiString" Size="10" Direction="Output" />

<asp:Parameter Name="磅重1" DbType="Int32" Size="4" Direction="Output" />
<asp:Parameter Name="磅重2" DbType="Int32" Size="4" Direction="Output" />
<asp:Parameter Name="磅重3" DbType="Int32" Size="4" Direction="Output" />
<asp:Parameter Name="磅重4" DbType="Int32" Size="4" Direction="Output" />
<asp:Parameter Name="日期" DbType="Date" Size="3" Direction="Output" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="ID" DbType="Int32" Size="4" Direction="Output" />
<asp:ControlParameter Name="原料ID" DbType="Int32" Size="4" ControlID="LeiBie"/>
<asp:ControlParameter Name="供货ID" DbType="Int32" Size="4" ControlID="GongHuo"/>

<asp:ControlParameter Name="车号" DbType="AnsiString" Size="10" ControlID="CheHao"/>

<asp:ControlParameter Name="磅重1" DbType="Int32" Size="4" ControlID="BangZhong1"/>
<asp:ControlParameter Name="磅重2" DbType="Int32" Size="4" ControlID="BangZhong2"/>
<asp:ControlParameter Name="磅重3" DbType="Int32" Size="4" ControlID="BangZhong3"/>
<asp:ControlParameter Name="磅重4" DbType="Int32" Size="4" ControlID="BangZhong4"/>
<asp:ControlParameter Name="日期" DbType="Date" Size="3" ControlID="Date1"/>
<asp:Parameter Name="保管员" DbType="String" Size="20" />
</InsertParameters>
<UpdateParameters>
<asp:ControlParameter Name="ID" DbType="Int32" Size="4" ControlID="Label_ID"/>
<asp:ControlParameter Name="原料ID" DbType="Int32" Size="4" ControlID="LeiBie"/>
<asp:ControlParameter Name="供货ID" DbType="Int32" Size="4" ControlID="GongHuo"/>
<asp:ControlParameter Name="车号" DbType="AnsiString" Size="10" ControlID="CheHao"/>

<asp:ControlParameter Name="磅重1" DbType="Int32" Size="4" ControlID="BangZhong1"/>
<asp:ControlParameter Name="磅重2" DbType="Int32" Size="4" ControlID="BangZhong2"/>
<asp:ControlParameter Name="磅重3" DbType="Int32" Size="4" ControlID="BangZhong3"/>
<asp:ControlParameter Name="磅重4" DbType="Int32" Size="4" ControlID="BangZhong4"/>
<asp:ControlParameter Name="日期" DbType="Date" Size="3" ControlID="Date1"/>
<asp:Parameter Name="保管员" DbType="String" Size="20" />
</UpdateParameters>
</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
SelectCommand="select ID, 名称 FROM 原料供货单位"></asp:SqlDataSource>

<asp:Label ID="Label_ID" runat="server" Text="0" Visible="false"></asp:Label>

<div id="wintop" class="wintop" style="display:none;">原料磅单录入</div>

<asp:Panel ID="Panel1" runat="server" CssClass="panel">
<asp:Button ID="Button_Save" runat="server" Text="保 存" UseSubmitBehavior="false"
        CssClass="button" onclick="Button_Save_Click"  />

<asp:Button ID="Button_ReNew" runat="server" Text="录入新磅单" UseSubmitBehavior="false" Visible="false"
        CssClass="button2" onclick="Button_ReNew_Click" />
        
<asp:Button ID="Button_Close" runat="server" Text="关 闭" UseSubmitBehavior="false"  Visible="true"
        CssClass="button" OnClientClick="parent.swin2_close();return false;" />

</asp:Panel>

<asp:Panel ID="Panel2" runat="server" CssClass="panel" HorizontalAlign="Center">
<table border=1 style="border-collapse:separate;font-size:14px;margin-top:7px;margin-bottom:28px;margin-top:10px;">
<tr>
<td height=50 colspan=4 align=center style="font-weight:bold; letter-spacing:20px;font-size:20px;border:none;">磅单信息</td>
</tr>
<tr>
<td height=40 width=100 align=right>原料类别：</td>
<td width=180>
<asp:DropDownList ID="LeiBie" runat="server" Width="150" Font-Size="14px">
    <asp:ListItem Text="油管光管(J55)" Value="1"></asp:ListItem>
    <asp:ListItem Text="套管光管(J55)" Value="2"></asp:ListItem>
    <asp:ListItem Text="油管接箍光管(J55)" Value="3"></asp:ListItem>
    <asp:ListItem Text="套管接箍光管(J55)" Value="4"></asp:ListItem>
    <asp:ListItem Text="成品油管接箍(J55)" Value="5"></asp:ListItem>
    <asp:ListItem Text="成品套管接箍(J55)" Value="6"></asp:ListItem>
    
    <asp:ListItem Text="油管光管(N80Q)" Value="101"></asp:ListItem>
    <asp:ListItem Text="套管光管(N80Q)" Value="102"></asp:ListItem>
    <asp:ListItem Text="油管接箍光管(N80Q)" Value="103"></asp:ListItem>
    <asp:ListItem Text="套管接箍光管(N80Q)" Value="104"></asp:ListItem>
    <asp:ListItem Text="成品油管接箍(N80Q)" Value="105"></asp:ListItem>
    <asp:ListItem Text="成品套管接箍(N80Q)" Value="106"></asp:ListItem>
    </asp:DropDownList>
</td>
<td width=100 align=right>供货单位：</td>
<td width=180><asp:DropDownList 
        ID="GongHuo" runat="server" DataSourceID="SqlDataSource2" Width="140px"
        DataTextField="名称" DataValueField="ID"></asp:DropDownList></td>
</tr>
<tr>
<td height=40 align=right>日期：</td>
<td><asp:TextBox ID="Date1" runat="server" CssClass="textbox" Width="120px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" /></td>

<td height=40 align=right>车号：</td>
<td><asp:TextBox ID="CheHao" runat="server" CssClass="textbox" Width="120px"></asp:TextBox></td>
</tr>

<tr>
<td height=40 align=right>磅重1：</td>
<td><asp:TextBox ID="BangZhong1" runat="server" CssClass="textbox" Width="120px"></asp:TextBox>kg</td>
<td align=right>磅重2：</td>
<td><asp:TextBox ID="BangZhong2" runat="server" CssClass="textbox" Width="120px"></asp:TextBox>kg</td>
</tr>

<tr>
<td height=40 align=right>磅重3：</td>
<td><asp:TextBox ID="BangZhong3" runat="server" CssClass="textbox" Width="120px"></asp:TextBox>kg</td>
<td align=right>磅重4：</td>
<td><asp:TextBox ID="BangZhong4" runat="server" CssClass="textbox" Width="120px"></asp:TextBox>kg</td>
</tr>

</table>

</asp:Panel>

</form>

<script >
    var notice = "<%=this.Notice %>";
    if (notice != "") {
        parent.showmsgbox(notice);
    }

    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            textboxs[i].onchange = function(e) { this.className = "textbox-changed"; if (this.id == "ShuLiang0") document.getElementById("ShuLiang").value = this.value; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "textbox") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }
    }

    document.onkeydown = function(e) {
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;
        if (tag.id == "BeiZhu") return;
        if (tag.tagName == "INPUT" && tag.className == "textbox" || tag.tagName == "SELECT" || tag.tagName == "DIV") {
            if (e.keyCode == 13) {
                e.keyCode = 9;
            }
        }
        else if (e.keyCode == 8) {
            return false;
        }
    }
    function makecalendar(d, o) {
        obj = o;
        idate = makedate(d);
        cdate = new Date(idate.getFullYear(), idate.getMonth(), 1);
        ds.style.left = (getObjectLeft(o) + 2 ) + "px";
        ds.style.top = (getObjectTop(o) - 70) + "px";
        ds.style.display = 'block';
        showcalendar();
    }
</script>
</body>
</html>
